import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { Sign } from './api/wechat'
import './utils/style/index.less'

import { Button, Icon, Dialog, Toast } from 'vant'
Vue.use(Button)
Vue.use(Icon)
Vue.use(Dialog)
Vue.use(Toast)
Toast.setDefaultOptions('loading', { forbidClick: true, duration: 0 }) // 将所有 loading Toast 设置为背景不可点击
Vue.config.productionTip = false

new Vue({
  router,
  store,
  beforeCreate() {
    Sign().then(res => {
      const { wx } = window
      wx.config({
        ...res,
        debug: false,
        jsApiList: ['scanQRCode'] // 必填，需要使用的JS接口列表
      })
      wx.ready(function () {})
      wx.error(function (err) {
        Toast(err.errMsg)
      })
    })
  },
  render: h => h(App)
}).$mount('#app')
